<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Commodity extends CI_Controller {
	
	function __construct()
	{
		parent::__construct();
		$this->seg_exp = segment_explode($this->uri->uri_string());
		$this->load->model('/admin/payment_method_m' ,'payment_method_m');
	}
	
	public function _remap($method, $params = array())
	{
		$this->load->view('admin/common/header');
		if( method_exists($this, $method) )
		{
			return call_user_func_array(array($this, $method), $params);
		} else if ($method == 'page') {
			$this->search();
		}
		$this->load->view('admin/common/footer');
	}
	
	public function index(){

 		//検索条件初期値
 		$param = array();
 		$payment_method_list = $this->payment_method_m->get_payment_method_list($param);
 		$data['payment_method_list']=$payment_method_list;
 		$this->load->view('admin/shop/payment_method_v', $this->$data);

	}
	public function commissons($payemtn_method_no=''){
		
		$param = array('payemtn_method_no'=>$payemtn_method_no);
		$payment_method_list = $this->payment_method_m->get_payment_method_list($param);
		$data['payment_method_list']=$payment_method_list;
		$commisson_list = $this->payment_method_m->get_commission_list($param);
		$data['commission_list']=$commisson_list;
		$this->load->view('admin/shop/payment_method_v', $this->$data);
	}
	
	public function detail($payemtn_method_no=''){
	
		$param = array('payemtn_method_no'=>$payemtn_method_no);
		$commisson_list = $this->payment_method_m->get_payment_method($param);
		$data['payment_method']=$commisson_list;
		$this->load->view('admin/shop/payment_detail_v', $this->$data);
	}
	
	public function new_payment(){
		$data = array();
		$this->load->view('admin/shop/payment_new_v', $this->$data);
	}
	
// 	public function search(){

// 		$this->url_seg = $this->seg_exp;
		
// 		$param = array();
		
// 		$param["s_category"] = $this->input->post('s_category');
// 		$param["s_commoditycode_from"] = $this->input->post('s_commoditycode_from');
// 		$param["s_commoditycode_to"] = $this->input->post('s_commoditycode_to');
// 		$param["s_skucode"] = $this->input->post('s_skucode');
// 		$param["s_commodity_name"] = $this->input->post('s_commodity_name');
// 		$param["s_keyword"] = $this->input->post('s_keyword');
// 		$param["s_sales_start_from"] = $this->input->post('s_sales_start_from');
// 		$param["s_sales_start_to"] = $this->input->post('s_sales_start_to');
// 		$param["s_sales_end_from"] = $this->input->post('s_sales_end_from');
// 		$param["s_sales_end_to"] = $this->input->post('s_sales_end_to');
// 		$param["s_stock"] = $this->input->post('s_stock');
		
// 		$checkbox = $this->input->post('s_sale_flg');
// 		$param["s_sale_flg"] = $checkbox;
		
		
		
// 		$this->_data['param'] = $param;
		
		
// 		$this->load->library('form_validation');
// // 		$this->form_validation->set_rules('s_commoditycode_from', '제목', 'required');
// // 		$this->form_validation->run();
	
// 		$this->load->view('admin/common/header');
// 		//$list = $this->commodity_model->searchLists($param);
		
		
// 		//あと,共通化
// 		if($this->uri->segment(4) == 'page')
// 		{
// 			$this->_data['page_account']= $page = 1;
// 		}
// 		else
// 		{
// 			//페이징
// 			if( in_array('page', $this->seg_exp) )
// 			{
// 				$this->_data['page_account'] = $page = urldecode($this->security->xss_clean(url_explode($this->seg_exp, 'page')));
// 			}
// 			else
// 			{
// 				$this->_data['page_account'] = $page = 1;
// 			}
// 		}
		
// 		$rp    = 20; //리스트 갯수(表示数)
// 		$limit = 10; //보여줄 페이지수
		
// 		$start = (($page-1) * $rp);
// 		//$start = 1;
		
		
// 		//$list = $this->commodity_model->searchLists($param,$start, $rp);
// 		$list = $this->commodity_model->get_commodity_lists($param,$start, $rp);
				
// 		//$data['rs']           = $this->commodity_model->gets($start, $rp);
// 		$this->_data['rs']           = $list;
		
// 		//$data['search_total'] = $total = $this->commodity_model->gets_total(); //$this->commodity_model->gets_total();
// 		//$data['search_total'] = $total = 1400; //$this->commodity_model->gets_total();
// 		$this->_data['search_total'] = $total = $this->commodity_model->gets_total($param);
// 		if( in_array('page', $this->seg_exp) )
// 		{
		
// 			$urls = implode('/', url_delete($this->url_seg, 'page'));
// 		}
// 		else
// 		{
// 			$urls = implode('/', $this->url_seg);
// 		}
		
// 		//TEST確認用
// 		//echo $urls.':'.$page.':'.$rp.':'.$total.':'.$limit.':'.$page;
		
// 		//$data['pagination_links'] = pagination_common($urls."/page", paging($page,$rp,$total,$limit));
		
		
// 		$this->_data['list'] = $list;
// 		$this->_data['condition'] = $param;
		
// 		//$this->load->view('admin/commodity/commodity_list', array('list'=>$list,'condition'=>$param));
// 		$this->load->view('admin/commodity/commodity_list', $this->_data);
// 		$this->load->view('admin/common/footer');
// 	}
	
// 	public function commodity_edit($param,$sku_code){
// 		$this->load->view('admin/common/header');
// 		$detail = $this->commodity_model->search_detail($sku_code);
// 		$this->load->view('admin/commodity/detail', array('detail'=>$detail));		
// 		$this->load->view('admin/common/footer');
// 	}
	
}

